//
//  ApeResponseError.h
//  ApeMVPresenter
//
//  Created by Eton on 2017/7/12.
//  Copyright © 2017年 王-庭协. All rights reserved.
//

#import <Foundation/Foundation.h>
/**
 *  错误代码
 */
typedef NS_ENUM(NSInteger, ErrorCodeType){
    /**
     *  成功
     */
    ErrorCodeTypeSuccess = 200,
    
    /**
     *  登录已经失效
     */
    ErrorCodeTypeLoginInvalid = 401,
    
    /**
     *  逻辑出错
     */
    ErrorCodeTypeLogicError = 403,
    
    /**
     *  接口路径错误
     */
    ErrorCodeTypePathError = 404,
    /**
     *  令牌失效
     */
    ErrorCodeTypeTokenInvalid = 406,
    /**
     *  账号从其他设备登录
     */
    ErrorCodeTypeLoginInOtherDevice = 410,
    
    /**
     *  服务器出错了
     */
    ErrorCodeTypeServiceError = 500
};

@interface ApeResponseError : NSError

+ (instancetype)errorWithCode:(NSInteger)code message:(NSString *)message;

/*
 * 错误信息userInfo里相对应的Key
 * 默认："message"
 */
@property (strong, nonatomic) NSString *messageKey;

@property (strong, nonatomic, readonly) NSString *handleErrorMessage;

@end
